package com.hyperchain.controller;

import com.hyperchain.config.kafka.KafkaProducerService;
import com.hyperchain.entity.DbAccount;
import com.hyperchain.mapper.AccountMapper;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequiredArgsConstructor
public class TestController {
    private final AccountMapper accountMapper;
    private final KafkaProducerService kafkaProducerService;

    @GetMapping("/user/list")
    public List<DbAccount> getList(){
        kafkaProducerService.sendMessage("my-topic", "hello world");
        return accountMapper.selectList(null);
    }
}
